const playerAction =process.argv[process.argv.length - 1]
if(playerAction !== 'rock' && playerAction !== 'paper' && playerAction !== 'scissors'){
    console.log('请输入 rock、paper 或 scissors')
}else{
    const arr = ['rock','paper','scissors']
    const index = Math.floor(Math.random() * 3)
    const computerAction = arr[index]
    console.log('你出了：' + playerAction)
    console.log('计算机出了：' + computerAction)
    if(playerAction === computerAction){
        console.log('平局')
    }else if(
        (playerAction === 'rock' && computerAction === 'paper') ||
        (playerAction === 'paper' && computerAction === 'scissors') ||
        (playerAction === 'scissors' && computerAction === 'rock')
    ){
        console.log('你输了')
    }else{
        console.log('你赢了')
    }
}
